package com.baiyapeng.code.service.remote;

import com.alibaba.dubbo.config.annotation.Method;
import com.alibaba.dubbo.config.annotation.Service;
import com.baiyapeng.code.aspect.annotation.Monitor;
import com.baiyapeng.code.dao.TbOrderMapper;
import com.baiyapeng.code.model.TbOrder;
import com.baiyapeng.code.service.OrderService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * <b>订单服务</b><br/>
 *
 * @author baiyapeng
 * @since 1.0.0
 */
@Service(methods = @Method(name = "findAllOrder", timeout = 20000, retries = 3))
@Component
@Slf4j
public class OrderServiceImpl implements OrderService {

    @Autowired
    private TbOrderMapper tbOrderMapper;

    /**
     * <p>查询全部订单</p>
     *
     * @param userName 用户名
     * @return
     */
    @Override
    @Monitor
    public List<TbOrder> findAllOrder(String userName) {
        log.debug("=============> 服务层正在查询：{} <=============", userName);
        return tbOrderMapper.selectAllByUserName(userName);
    }
}
